package taskit.gui;

import taskit.logic.Parser;

//@author A0098710B
public class GUIDispatcher
{
	/**
	 * Passes input string to Parser
	 * 
	 * @param	stringToParse the input string
	 * 
	 */
	public static void dispatchToParser(String stringToParse)
	{
		Parser.passInputString(stringToParse);
	}
	
	/**
	 * Changes the attached .css file to the application
	 * 
	 * @param	fileName the name of the .css file
	 * 
	 */
	public static void changeTheme(String fileName) {
		
		assert fileName.endsWith(".css") : "invalid css file name";
		
		GUIController.stagePrimary
				.getScene()
				.getStylesheets()
				.remove(GUI.class.getResource(GUIController.currentTheme)
						.toExternalForm());
		if (!GUIController.stagePrimary.getScene().getStylesheets()
				.contains(GUI.class.getResource(fileName).toExternalForm())) {
			GUIController.stagePrimary.getScene().getStylesheets()
					.add(GUI.class.getResource(fileName).toExternalForm());
			GUIController.currentTheme = fileName;
		}
	}
}